Conversation
Toggle a root CSS class to swap red/green with blue/orange in diff contexts (panel backgrounds, header stats, inline stat labels). Colors from GitHub Primer's @primer/primitives diffBlob tokens. Follows the same root-class pattern as the high-contrast mode proposal (pingdotgg#1284). Closes pingdotgg#1537
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds an opt-in Colorblind mode client setting that swaps red/green comparative diff colors to a blue/orange palette by toggling a root CSS class and applying scoped CSS/variable overrides.
Changes:
- Extend client settings schema with
colorblindMode(defaultfalse) and add contract/unit coverage. - Apply
colorblind-moderoot class at startup and keep it in sync at runtime via the root route. - Update diff/stat UI to use new CSS hooks and update diff panel CSS variable overrides when enabled.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/contracts/src/settings.ts | Adds colorblindMode to ClientSettingsSchema with a decoding default. |
| packages/contracts/src/settings.test.ts | Verifies DEFAULT_CLIENT_SETTINGS.colorblindMode defaults to false. |
| apps/web/src/hooks/useSettings.ts | Adds helpers to toggle the root class and read the persisted value early. |
| apps/web/src/hooks/useSettings.test.ts | Ensures legacy migration patch does not attempt to migrate colorblindMode. |
| apps/web/src/main.tsx | Applies colorblind mode before first React render to avoid a flash. |
| apps/web/src/routes/__root.tsx | Keeps the root class synced with live settings via an effect. |
| apps/web/src/index.css | Defines blue/orange variables under :root.colorblind-mode and stat color classes. |
| apps/web/src/components/settings/SettingsPanels.tsx | Adds Settings > General toggle + restore-defaults detection for the new setting. |
| apps/web/src/components/chat/DiffStatLabel.tsx | Uses new stat CSS classes so the palette can be overridden by colorblind mode. |
| apps/web/src/components/GitActionsControl.tsx | Uses new stat CSS classes for per-file/total insertions/deletions. |
| apps/web/src/components/DiffPanel.tsx | Dynamically switches @pierre/diffs override variables based on the setting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Fix diff-stat default colors to use --color-success/--color-destructive (matching text-success/text-destructive) instead of the -foreground variants. Add try/catch around getStoredColorblindMode to prevent malformed localStorage from crashing startup. Merge duplicate imports.
|
@juliusmarminge Rewrote this to follow the same root-class pattern as #1284. Toggles The one intentional difference: colorblind mode only overrides diff-specific elements, not |
Resolve modify/delete conflict on packages/contracts/src/settings.test.ts by accepting main's deletion — the file was removed in pingdotgg#1538 and the colorblind default is covered by the schema itself. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

What Changed
Added an opt-in Colorblind mode toggle in Settings > General. When enabled, all places where red and green appear side by side to distinguish additions from deletions switch to blue/orange instead.
This uses a CSS-first approach: toggling a
colorblind-modeclass on:rootand defining scoped overrides inindex.css. This is the same pattern as the high-contrast mode proposal in #1284, and both can coexist cleanly (:root.colorblind-mode.high-contrastjust applies both rule sets).What colorblind mode is NOT
It is not a global theme override.
--successand--destructiveare intentionally left untouched at the root level. Red is fine for error messages, delete buttons, and warnings because those don't appear next to green. The problem is specifically red next to green in comparative contexts (additions vs deletions), so the override is scoped only to those elements.Areas covered
-N/+Nheader stats (via@pierre/diffsCSS variable overrides)+additions / -deletionstext in chat messages+insertions / -deletionsin the commit dialogColor palette
From GitHub's Primer design system (
@primer/primitivesdiffBlob tokens), the most widely deployed colorblind-friendly diff palette in production.#0969da#bc4c00#388bfd#db6d28References:
Why
I'm colorblind. Red and green look the same to me, which makes diffs and stats hard to read.
Closes #1537
Compatibility with #1284
This PR follows the exact same architecture as the high-contrast mode proposal:
colorblind-modeclass on<html>)index.css(single source of truth)main.tsxto prevent FOUCuseEffectin the root routeA future unified appearance system would just manage which root classes are active.
UI Changes
Settings toggle (off by default):
Diff panel -- default (red/green) vs colorblind mode (blue/orange):
Diff stats in chat -- default vs colorblind mode:
Checklist
Note
Low Risk
Low risk UI/accessibility change that primarily adds CSS overrides and a new client-side setting; main risk is minor styling regressions in diff rendering and stat labels.
Overview
Adds an opt-in
colorblindModeclient setting (defaultfalse) with a new toggle in Settings → General, and ensures it’s included in “restore defaults” dirty-state labeling.Implements a CSS-first blue/orange palette by toggling a
colorblind-modeclass on:root(applied on startup and kept in sync at runtime), updates diff rendering (DiffPanel) to swap@pierre/diffsaddition/deletion variables based on the setting, and standardizes diff stat coloring via new.diff-stat-addition/.diff-stat-deletionclasses used in chat and the commit dialog.Written by Cursor Bugbot for commit 623d6ff. This will update automatically on new commits. Configure here.
Note
Add colorblind mode setting that switches diff colors to blue/orange
colorblindModeboolean toClientSettingsSchemaand exposes a toggle in the General settings panel via SettingsPanels.tsx.colorblind-modeclass todocument.documentElementon startup via main.tsx and keeps it in sync at runtime via a newColorblindModeSynccomponent in __root.tsx..diff-stat-addition/.diff-stat-deletionclasses in index.css that switch from green/red to blue/orange when thecolorblind-modeclass is present.Macroscope summarized 623d6ff.